//
//  userFirstTableViewCell.m
//  lmq
//
//  Created by 千翼网络科技 on 2017/1/17.
//  Copyright © 2017年 yuanxin. All rights reserved.
//

#import "userFirstTableViewCell.h"
#import "UIView+Common.h"
#import "settingViewController.h"
#import "Masonry.h"
#import "MyBecomeManagerViewController.h"
@implementation userFirstTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backView=[[UIView alloc]initWithFrame:CGRectMake(0,  0, DEF_SCREEN_WIDTH, (190))];
        self.backView.backgroundColor=[UIColor whiteColor];
        [self addSubview:self.backView];
        
        // 图片
        self.imageShowView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, DEF_SCREEN_WIDTH, (190))];
        self.imageShowView.image=[UIImage imageNamed:@"top"];
        [self.backView addSubview:self.imageShowView];
        
        
        //右按钮
        self.setButton=[[UIButton alloc]initWithFrame:CGRectMake(DEF_SCREEN_WIDTH-(26+8), (34-8), (22), (22))];
        [self.setButton setImage:[UIImage imageNamed:@"settings"] forState:UIControlStateNormal];
        [self.setButton addTarget:self action:@selector(setButtonClick) forControlEvents:UIControlEventTouchUpInside];
        [self.backView addSubview:self.setButton];
        
        //头像
        self.touImageView=[[UIImageView alloc]init];
        [self.backView addSubview:self.touImageView];
        
        [self.touImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.backView.mas_centerY);
            make.left.equalTo(self.backView).with.offset(30);
            make.height.offset(70);
            make.width.offset(70);
            
        }];
        

        
        self.touImageView.image=[UIImage imageNamed:@"tou"];
        
        //名称
        self.nameLable=[[UILabel alloc]init];
        [self.backView addSubview:self.nameLable];
        [self.nameLable mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.touImageView.mas_top).with.offset(10);
            make.left.equalTo(self.touImageView.mas_right).with.offset(20);
            make.height.offset(14);
            make.width.offset(150);
            
        }];

//        self.nameLable.text=@"这里是我的名字";
        self.nameLable.textColor=[UIColor whiteColor];
        self.nameLable.font=[UIFont boldSystemFontOfSize:(14)];
        
        
        
        
        self.idLabel = [[UILabel alloc] init];
        [self.backView addSubview:self.idLabel];
        self.idLabel.textColor = [UIColor whiteColor];
//        self.idLabel.text = @"asdasd";
        self.idLabel.font = [UIFont boldSystemFontOfSize:12];
        [self.idLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.nameLable.mas_bottom).with.offset(10);
            make.left.equalTo(self.touImageView.mas_right).with.offset(20);
            make.height.offset(12);
            make.width.offset(150);
    
        }];
        
        
        //等级
        self.timeLable=[[UILabel alloc]init];
        self.timeLable.layer.masksToBounds=YES;
//        self.timeLable.textAlignment=NSTextAlignmentCenter;
//        self.timeLable.layer.cornerRadius=(8.0);
//        self.timeLable.text =@"店主等级 Lv1";
        self.timeLable.font=[UIFont systemFontOfSize:(12)];
        self.timeLable.textColor = [UIColor whiteColor];
//        self.timeLable.backgroundColor=[UIColor whiteColor];
        [self.imageShowView addSubview:self.timeLable];
        
        [self.timeLable mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.idLabel.mas_bottom).with.offset(10);
            make.left.equalTo(self.touImageView.mas_right).with.offset(20);
            make.height.offset(12);
            make.width.offset(150);
            
        }];
        
        
        //点数
        self.dianNumLabel=[[UILabel alloc]init];
        self.dianNumLabel.layer.masksToBounds=YES;
        //        self.timeLable.textAlignment=NSTextAlignmentCenter;
        //        self.timeLable.layer.cornerRadius=(8.0);
        //        self.timeLable.text =@"店主等级 Lv1";
        self.dianNumLabel.font=[UIFont systemFontOfSize:(12)];
        self.dianNumLabel.textColor = [UIColor whiteColor];
        //        self.timeLable.backgroundColor=[UIColor whiteColor];
        [self.imageShowView addSubview:self.dianNumLabel];
        self.dianNumLabel.text = @"店主点数";
        [self.dianNumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.timeLable.mas_bottom).with.offset(10);
            make.left.equalTo(self.touImageView.mas_right).with.offset(20);
            make.height.offset(12);
            make.width.offset(150);
            
        }];
        
        
        self.becomeShop = [[UIButton alloc] init];
        [self.backView addSubview:self.becomeShop];
        [self.becomeShop setTitle:@"成为店主" forState:UIControlStateNormal];
        [self.becomeShop setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        self.becomeShop.layer.borderWidth = 1.0f;
        self.becomeShop.titleLabel.font = [UIFont systemFontOfSize:14];
        self.becomeShop.layer.borderColor = [UIColor whiteColor].CGColor;
        [self.becomeShop addTarget:self action:@selector(becomeDianZhu) forControlEvents:UIControlEventTouchUpInside];
        
        [self.becomeShop mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.backView.mas_centerY);
            make.right.equalTo(self.backView).with.offset(-30);
            make.height.offset(20);
            make.width.offset(80);
            
        }];
        
        
        
        

    }
    return self;
}

-(void)setButtonClick{
    NSLog(@"设置");
    settingViewController *settingVC=[[settingViewController alloc]init];
    settingVC.hidesBottomBarWhenPushed=YES;
    [((userViewController *)self.firstViewController).navigationController pushViewController:settingVC animated:YES];
}
- (void)becomeDianZhu{

    NSLog(@"设置");
    MyBecomeManagerViewController *settingVC=[[MyBecomeManagerViewController alloc]init];
    settingVC.hidesBottomBarWhenPushed=YES;
    [((userViewController *)self.firstViewController).navigationController pushViewController:settingVC animated:YES];
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
